<%@ page language="java" contentType="text/html; charset=utf-8"   pageEncoding="utf-8"%>
<!DOCTYPE html>
<meta charset="UTF-8">
<script>
// 浏览器桌面通知
function showNotice() {
	if (!('Notification' in window)) {
        alert('你的浏览器不支持Notification')
    }//检查是否拥有通知权限；有就通知，没有请求；
	/* else if (Notification.permission=='granted') {
	    var options={
    		dir: "auto",
            lang: "hi",
            tag: "testTag",
            icon: "https://static.cnblogs.com/images/adminlogo.gif",
            body: "通知content"
	    }
	    var notification=new Notification('这是一个通知撒:',options);

	} else if (Notification.permission !== 'denied'){ //点击同意后的操作
	    Notification.requestPermission().then(function(result){
	        if(result=='granted'){
	            var notification=new Notification('hello wolrld!',options);
	        }
	    })    
	} */
	else { 
	    Notification.requestPermission().then(function(result){
	        if(result=='granted'){
	            var notification = new Notification('通知', {
		    		dir: "auto",
	                lang: "hi",
	                tag: "testTag",
	                icon: "${ctxPath }/favicon.ico",
	                body: "通知content"
	            });
	            setTimeout(function(){
	            	notification.close();
				}, 4000);
	        }
	    })  
	}
	
}
showNotice();
</script>